<html>
<head><meta charset="utf-8"><title>Tests with optimization-level specified by the test? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html">Tests with optimization-level specified by the test?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="137008401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137008401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137008401">(Nov 02 2018 at 12:33)</a>:</h4>
<p>I remember us having a lot of trouble with tests not being able to specify the optimisation level they are aimed to. Usually the workaround was to use <code>-Cno-prepopulate-passes</code>. Well, now that I’m trying to make some tests for <code>#[optimize]</code> attribute, that does not work, because doing a <code>-Cno-prepopulate-passes</code> does not actually influence the optimisation flags, so something like the following code:</p>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(optimize_attribute)]</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[optimize(size)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">size</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[optimize(speed)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">speed</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>cannot be tested with various sets of <code>-O</code> and <code>-Copt-level</code> flags to ensure the correct codegen. Any easy way out?</p>



<a name="137009001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137009001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137009001">(Nov 02 2018 at 12:36)</a>:</h4>
<p>There are notable differences in how these functions are compiled with different flags (esp. the <code>foo</code>) function. This is what is generated with no optimisation flags:</p>
<div class="codehilite"><pre><span></span><span class="c">; Function Attrs: nonlazybind optnone uwtable</span>
<span class="k">define</span> <span class="k">i32</span> <span class="vg">@test</span><span class="err">::foo</span><span class="p">()</span> <span class="k">unnamed_addr</span> <span class="vg">#0</span> <span class="p">{</span>
<span class="nl">start:</span>
  <span class="nv nv-Anonymous">%0</span> <span class="p">=</span> <span class="k">call</span> <span class="p">{</span> <span class="k">i32</span><span class="p">,</span> <span class="k">i1</span> <span class="p">}</span> <span class="vg">@llvm.sadd.with.overflow.i32</span><span class="p">(</span><span class="k">i32</span> <span class="m">2</span><span class="p">,</span> <span class="k">i32</span> <span class="m">2</span><span class="p">)</span>
  <span class="nv nv-Anonymous">%1</span> <span class="p">=</span> <span class="k">extractvalue</span> <span class="p">{</span> <span class="k">i32</span><span class="p">,</span> <span class="k">i1</span> <span class="p">}</span> <span class="nv nv-Anonymous">%0</span><span class="p">,</span> <span class="m">0</span>
  <span class="nv nv-Anonymous">%2</span> <span class="p">=</span> <span class="k">extractvalue</span> <span class="p">{</span> <span class="k">i32</span><span class="p">,</span> <span class="k">i1</span> <span class="p">}</span> <span class="nv nv-Anonymous">%0</span><span class="p">,</span> <span class="m">1</span>
  <span class="k">br</span> <span class="k">i1</span> <span class="nv nv-Anonymous">%2</span><span class="p">,</span> <span class="kt">label</span> <span class="nv">%panic</span><span class="p">,</span> <span class="kt">label</span> <span class="nv">%bb1</span><span class="p">,</span> <span class="nv">!prof</span> <span class="nv nv-Anonymous">!1</span>

<span class="nl">bb1:</span>                                              <span class="c">; preds = %start</span>
<span class="p">&lt;</span><span class="err">snip</span><span class="p">&gt;</span>

<span class="nl">panic:</span>                                            <span class="c">; preds = %start</span>
<span class="p">&lt;</span><span class="err">snip</span><span class="p">&gt;</span>
<span class="p">}</span>
</pre></div>


<p>whereas if compiled with <code>-Copt-level=z</code> you get</p>
<div class="codehilite"><pre><span></span><span class="c">; Function Attrs: minsize norecurse nounwind nonlazybind optsize readnone uwtable</span>
<span class="k">define</span> <span class="k">i32</span> <span class="vg">@test</span><span class="err">::foo</span><span class="p">()</span> <span class="k">unnamed_addr</span> <span class="vg">#0</span> <span class="p">{</span>
<span class="nl">start:</span>
  <span class="k">ret</span> <span class="k">i32</span> <span class="m">4</span>
<span class="p">}</span>
</pre></div>


<p>and so on and forth.</p>



<a name="137009631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137009631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137009631">(Nov 02 2018 at 12:39)</a>:</h4>
<p>It would be ideal, even, if we could use the same test file with multiple configurations… just like <a href="https://github.com/llvm-mirror/llvm/blob/master/test/CodeGen/ARM/umulo-128-legalisation-lowering.ll#L2" target="_blank" title="https://github.com/llvm-mirror/llvm/blob/master/test/CodeGen/ARM/umulo-128-legalisation-lowering.ll#L2">LLVM does it</a>.</p>



<a name="137027930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137027930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137027930">(Nov 02 2018 at 13:54)</a>:</h4>
<p><strong>TL;DR</strong> I’m looking a way to write a codegen test that can vary over an optimization level flag.</p>



<a name="137073267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137073267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137073267">(Nov 02 2018 at 18:27)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> can you use revisions to do it?</p>



<a name="137073272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137073272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137073272">(Nov 02 2018 at 18:27)</a>:</h4>
<p>you can do <code>// revisions: foo bar</code> for example in a test</p>



<a name="137073276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137073276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137073276">(Nov 02 2018 at 18:27)</a>:</h4>
<p>and then do <code>//[foo] compile-flags: ...</code></p>



<a name="137073279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137073279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137073279">(Nov 02 2018 at 18:27)</a>:</h4>
<p>and <code>//[bar] compile-flags: ...</code></p>



<a name="137100178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137100178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137100178">(Nov 03 2018 at 05:07)</a>:</h4>
<p>revisions sound nice, but can one specify arbitrary compile-flags? What I need is specifically <code>-Copt-level</code>. I recall it wasn’t possible before.</p>



<a name="137106297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137106297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137106297">(Nov 03 2018 at 09:09)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="c1">// revisions: NO-OPT SIZE-OPT SPEED-OPT</span>
<span class="c1">// [NO-OPT] compile-flags: -Copt-level=0</span>
<span class="c1">// [SIZE-OPT] compile-flags: -Copt-level=s</span>
<span class="c1">// [SPEED-OPT] compile-flags: -Copt-level=3</span>

<span class="cp">#![feature(optimize_attribute)]</span><span class="w"></span>

<span class="c1">// NO-OPT: Function Attrs:{{.*}}optnone</span>
<span class="c1">// NO-OPT-NOT: {{optsize|minsize}}</span>
<span class="c1">// NO-OPT-NEXT: @nothing</span>
<span class="c1">// NO-OPT: ret i32 %1</span>
<span class="c1">//</span>
<span class="c1">// SIZE-OPT: Function Attrs:{{.*}}optsize</span>
<span class="c1">// SIZE-OPT-NOT: {{minsize|optnone}}</span>
<span class="c1">// SIZE-OPT-NEXT: @nothing</span>
<span class="c1">// SIZE-OPT-NEXT: start</span>
<span class="c1">// SIZE-OPT-NEXT: ret i32 4</span>
<span class="c1">//</span>
<span class="c1">// SPEED-OPT: Function Attrs:</span>
<span class="c1">// SPEED-OPT-NOT: {{minsize|optnone|optsize}}</span>
<span class="c1">// SPEED-OPT-NEXT: @nothing</span>
<span class="c1">// SPEED-OPT-NEXT: start</span>
<span class="c1">// SPEED-OPT-NEXT: ret i32 4</span>
<span class="cp">#[no_mangle]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">nothing</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="c1">// CHECK: Function Attrs:{{.*}} minsize{{.*}}optsize</span>
<span class="c1">// CHECK-NEXT: @size</span>
<span class="c1">// CHECK-NEXT: start</span>
<span class="c1">// CHECK-NEXT: ret i32 4</span>
<span class="cp">#[optimize(size)]</span><span class="w"></span>
<span class="cp">#[no_mangle]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">size</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="c1">// CHECK: Function Attrs:</span>
<span class="c1">// CHECK-NOT: {{minsize|optsize|optnone}}</span>
<span class="c1">// CHECK-NEXT: @speed</span>
<span class="c1">// CHECK-NEXT: start</span>
<span class="c1">// CHECK-NEXT: ret i32 4</span>
<span class="cp">#[optimize(speed)]</span><span class="w"></span>
<span class="cp">#[no_mangle]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">speed</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="137106389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/137106389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#137106389">(Nov 03 2018 at 09:12)</a>:</h4>
<p>is the test I’m trying to write. Alas, the codegen tests do not support "revisions" in the first place: </p>
<div class="codehilite"><pre><span></span>---- [codegen] codegen/optimize-attr-1.rs#NO-OPT stdout ----
thread &#39;[codegen] codegen/optimize-attr-1.rs#NO-OPT&#39; panicked at &#39;revisions not relevant here&#39;, tools/compiletest/src/runtest.rs:2093:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
</pre></div>



<a name="146857060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146857060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146857060">(Nov 06 2018 at 10:33)</a>:</h4>
<p>I was just encountering this yesterday. providing <code>-Copt-level</code> in a <code>// compile-flags</code> is no good because the test driver will also inject its own <code>-O</code> and then the <code>rustc</code> invocation will error out because of multiple <code>opt-level</code> options being provided</p>



<a name="146857069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146857069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146857069">(Nov 06 2018 at 10:34)</a>:</h4>
<p>Maybe we can add a <code>// opt-level: ...</code> annotation for the test, and then that overrides whatever the default is in <code>compiletest</code> ?</p>



<a name="146857117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146857117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146857117">(Nov 06 2018 at 10:34)</a>:</h4>
<p>(my own scenario was a run-pass test, not a codegen one, but I imagine the issues are similar...)</p>



<a name="146864234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146864234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146864234">(Nov 06 2018 at 13:20)</a>:</h4>
<p>Hmm. Doesn't the same scenario arguably arise with debuginfo-tests? I had to actually manually add <code>-g</code> to a test just now via <code>// compile-flags: ...</code>, which strikes me as odd because the config.toml.example says that <code>debuginfo-tests=true</code> is the default...</p>



<a name="146864762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146864762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146864762">(Nov 06 2018 at 13:31)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> It shouldn't be too hard to add revisions support for codegen tests. <code>runtest.rs</code> has most of the code.</p>



<a name="146873375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146873375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146873375">(Nov 06 2018 at 15:54)</a>:</h4>
<p>yeah, but revisions is of least concern to me, I’ll have to work on making sure <code>-Copt-level</code> works in <code>compile-flags</code>.</p>



<a name="146873527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146873527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146873527">(Nov 06 2018 at 15:57)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> what do you think of instead adding a <code>// opt-level: N</code> (and <code>// debuginfo: N</code>) property to tests?</p>



<a name="146873544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146873544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146873544">(Nov 06 2018 at 15:58)</a>:</h4>
<p>(that then overrides any default in use by the compiletest environment)</p>



<a name="146876380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146876380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146876380">(Nov 06 2018 at 16:35)</a>:</h4>
<p>doesn’t sound general enough – I’m sure we’ll end up hitting more obscure flags like these in the future.</p>



<a name="146876401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146876401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146876401">(Nov 06 2018 at 16:35)</a>:</h4>
<p>I’d rather just parse the compile-flags line and override all default options in compiletest.</p>



<a name="146885410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146885410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146885410">(Nov 06 2018 at 18:55)</a>:</h4>
<p>hmm. well at some point we'll have to wonder if we're better off pulling the option definitions out into their own crate that <code>compiletest</code> could link to...</p>



<a name="146928352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146928352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146928352">(Nov 07 2018 at 09:20)</a>:</h4>
<p>maybe add something like // ignore-default-flags: &lt;flags not to add by default&gt;</p>



<a name="146932593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146932593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146932593">(Nov 07 2018 at 11:01)</a>:</h4>
<p>@mw that sounds just has hard to implement as what <span class="user-mention" data-user-id="123586">@nagisa</span> is describing, and harder to use, no?</p>



<a name="146969194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Tests%20with%20optimization-level%20specified%20by%20the%20test%3F/near/146969194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F.html#146969194">(Nov 07 2018 at 16:17)</a>:</h4>
<p>oh right, I didn't see that. Seems like a fine solution.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>